using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using THSLib;
using THSERP.BusinessEntities;
namespace THSERP.BaseProvider
{
    public partial class guiLogOffWarning : DevExpress.XtraEditors.XtraForm
    {
        public const String cstModusEdit = "Edit";
        public const String cstModusNew = "Create";
        public guiLogOffWarning()
        {
            InitializeComponent();
        }
        private void fld_btnOK_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void guiLogOffWarning_Load(object sender, EventArgs e)
        {
            List<GEUserAuditsInfo> lstGEUserAuditsInfo = new List<GEUserAuditsInfo>();
            int iADUserID = new ADUsersController().GetObjectIDByName(THSApp.CurrentUser);
            DataSet dsUserAudits  = new GEUserAuditsController().GetAllObjects();
            foreach (DataRow row in dsUserAudits.Tables[0].Rows)
            {
                GEUserAuditsInfo objGEUserAuditsInfo = new GEUserAuditsController().GetObjectFromDataRow(row) as GEUserAuditsInfo;
                if(objGEUserAuditsInfo.ADUserID.Equals(iADUserID)&& objGEUserAuditsInfo.ADUserName.Equals(THSApp.CurrentUser))
                {
                    if(objGEUserAuditsInfo.GEUserAuditAction == cstModusEdit || objGEUserAuditsInfo.GEUserAuditAction == cstModusNew)
                        lstGEUserAuditsInfo.Add(objGEUserAuditsInfo);
                }
            
            }
            fld_dgcMessageWarning.DataSource = lstGEUserAuditsInfo;
        }
    }
}